package com.cloud.code.真题;

import java.util.Scanner;

public class Demo23 {


    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.nextLine());
        int M = Integer.parseInt(scanner.nextLine());

        String[] Ms = scanner.nextLine().split(" ");
        int[] ints_M = new int[M];
        for (int i = 0; i < Ms.length; i++) {
            ints_M[i] = Integer.parseInt(Ms[i]);
        }

        int K = Integer.parseInt(scanner.nextLine());

        // 开始补种 滑动窗口，首先知道补种也必须是连续的才有可能获得最大连续棵树，然后设定左右指针，保证中间有K棵树补种
        int max = 0;
        for (int i = 0; i <= ints_M.length - K; i++) {
            int le = 0;
            int ri = N;
            if (i > 0) {
                le = ints_M[i - 1];
            }

            if (i + K < ints_M.length) {
                ri = ints_M[i + K] - 1;
            }

            int temp = ri - le;
            if (temp > max) {
                max = temp;
            }
        }

        System.out.println(max);
    }
}
